import {IsEmail, IsNotEmpty, IsNumberString, Length} from "class-validator";
import { ApiProperty } from "@nestjs/swagger";

export class UserLoginDto {

  @ApiProperty({
    description: "用户名",
    required: true
  })
  @IsNotEmpty()
  username: string;

  @ApiProperty({
    description: "密码",
    required: true
  })
  @IsNotEmpty()
  password: string;

}

export class EmailDto {
  @ApiProperty({
    description: "邮件",
    required: true
  })
  @IsNotEmpty()
  @IsEmail()
  email: string;
}

export class UserRegisterDto extends UserLoginDto{

  @ApiProperty({
    description: "邮件",
    required: true
  })
  @IsNotEmpty()
  @IsEmail()
  email: string;

  @ApiProperty({
    description: "邮箱验证码",
    required: true
  })
  @IsNotEmpty()
  @IsNumberString()
  @Length(6,6)
  code: number;

}

export class UserDto {


  @ApiProperty({
    description: "用户id"
  })
  password: string;

  @ApiProperty({
    description: "用户名"
  })
  @IsNotEmpty()
  username: string;


  @ApiProperty({
    description: "邮件"
  })
  @IsNotEmpty()
  email: string;
}
